/* JSEncrypt加密 /
rsaPublicData(data) {
var jsencrypt = new JSEncrypt()
jsencrypt.setPublicKey(publicKey)
// 如果是对象/数组的话，需要先JSON.stringify转换成字符串
var result = jsencrypt.encrypt(data)
return result
},
*/
import JSEncrypt from 'jsencrypt'
import Encrypt from 'encryptlong'
var pubKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJs0Sy27nSVJo4MFa7RLacxWKCrHNNwWrFRW4TVhh3UGMI7GAbmBx+HYZ3UEuvfdvCcj8w8o66XekoM8FUlYI20CAwEAAQ=='
let rsa = {
	/* JSEncrypt加密*/
	rsaPublicData(data) {
		var jsencrypt = new JSEncrypt()
		jsencrypt.setPublicKey(pubKey)
		// 如果是对象/数组的话，需要先JSON.stringify转换成字符串
		if (!(typeof data == 'string') && !data.constructor == String) {
			data = JSON.stringify(data)
		}
		var result = jsencrypt.encrypt(data)
		return result
	},

	/* Encrypt 加密*/
	getEncrypt(data) {
		let encrypt = new Encrypt();
		encrypt.setPublicKey(pubKey);
		let info = encrypt.encryptLong(JSON.stringify(data))
		// console.log(info)
		return info
	},

	/* Encrypt 加密*/
	getDecrypt(data) {
		let decrypt = new Encrypt();
		decrypt.setPrivateKey(pubKey);
		let info = decrypt.decryptLong(data)
		return info
	}
}
export default rsa